#include "fish.h"

static fish_klass_info local_fish_klass = {fish_init};
fish_klass_info* fish_klass = &local_fish_klass;

static fish* fish_ctor(fish* self)
{
	((voidf)(klass_of(self)->super->ctor))(self);
	self->in_sea = TRUE;
	return self;
}

static char* local_fish_move(fish* self)
{
	(void)self;
	return "swim";
}

void fish_init(void)
{
	if(KLASS(fish_klass)->init)
	{
		animal_init();
		memcpy(fish_klass, animal_klass, sizeof(animal_klass_info));
		KLASS(fish_klass)->super = animal_klass;
		KLASS(fish_klass)->name = "fish_klass";
		KLASS(fish_klass)->size = sizeof(fish);
		KLASS(fish_klass)->ctor = fish_ctor;
		ANIMAL_KLASS(fish_klass)->move = local_fish_move;
	}
}

BOOL fish_is_in_sea(fish* self)
{
	return self->in_sea;
}

void fish_set_in_sea(fish* self, BOOL in_sea)
{
	self->in_sea = in_sea;
}